<template>
    <span class="textbutton" @click="onDelete">
        <slot></slot>
    </span>
</template>

<script lang="ts" setup>
import { showDialog } from 'vant'

const emits = defineEmits(["onconfirm"])
const props = defineProps({
    text: {
        type: String,
        default: "是否删除当前数据"
    }
})
const onDelete = () => {
    showDialog({
        title: '提示',
        message: props.text,
        showCancelButton: true
    }).then(() => {
        emits('onconfirm')
    }).catch(() => { })
}
</script>